Tailwind CSS

FLex on Larger Devices


To create responsive designs in Tailwind CSS, you can use the utility classes that tailor your layout based on screen size. To "flex" on larger devices, you typically utilize the flex and justify classes in combination with media breakpoints.

 

Flex Direction for Large Screens:

Use the flex-direction utilities to control how flex items are arranged within the container.

 

  • flex-row: Arranges items horizontally in the same direction as text (default).
  • flex-row-reverse: Arranges items horizontally in the opposite direction.
  • flex-col: Stacks items vertically.
  • flex-col-reverse: Stacks items vertically in the reverse order.

 

Example:

<div class="flex justify-between sm:justify-center lg:justify-around">
 <div class="bg-red-500 w-24 h-24"></div>
 <div class="bg-blue-500 w-24 h-24"></div>
 <div class="bg-green-500 w-24 h-24"></div>
</div>